package vista;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import controlador.Sistema;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class AltaProve extends javax.swing.JFrame {
	private JLabel lblCUIT;
	private JTextField txtCUIT;
	private JTextField txtNombre;
	private JButton btnCancelar;
	private JButton brnAceptar;
	private JLabel lblnombre;

	/**
	* Auto-generated main method to display this JFrame
	*/
	
	public AltaProve() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("Alta de Proveedor");
			getContentPane().setLayout(null);
			{
				lblCUIT = new JLabel();
				getContentPane().add(lblCUIT);
				lblCUIT.setText("CUIT: ");
				lblCUIT.setBounds(55, 46, 94, 21);
			}
			{
				txtCUIT = new JTextField();
				getContentPane().add(txtCUIT);
				txtCUIT.setBounds(173, 47, 163, 21);
			}
			{
				lblnombre = new JLabel();
				getContentPane().add(lblnombre);
				lblnombre.setText("Nombre: ");
				lblnombre.setBounds(55, 98, 94, 21);
			}
			{
				txtNombre = new JTextField();
				getContentPane().add(txtNombre);
				txtNombre.setBounds(173, 98, 163, 21);
			}
			{
				brnAceptar = new JButton();
				getContentPane().add(brnAceptar);
				brnAceptar.setText("Aceptar");
				brnAceptar.setBounds(79, 174, 104, 36);
				brnAceptar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						Sistema.getInstancia().crearProv(txtCUIT.getText(), txtNombre.getText());
					}
				});
			}
			{
				btnCancelar = new JButton();
				getContentPane().add(btnCancelar);
				btnCancelar.setText("Cancelar");
				btnCancelar.setBounds(199, 174, 104, 36);
				btnCancelar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						dispose();
					}
				});
			}
			pack();
			setSize(400, 300);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

}
